<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    (function () {
        //浅拷贝
        var obj1 = {
            name:"wang",
            age:18,
            like:['sports',"foods","money"]
        };
        var obj2 = {};
        function extend(obj1,obj2) {
            for(var key in obj1){
                obj2[key] = obj1[key]
            }
        }
        extend(obj1,obj2);
        console.dir(obj1);
        console.dir(obj2);
    }());
</script>
</body>
</html>